using System;
using Castle.ActiveRecord;

namespace demoapp.Models
{
	[ActiveRecord]
	public class Comment : ActiveRecordBase<Comment>
	{
		private string m_author;
		private string m_content;
		private int id;
		private Post m_post;
		private DateTime m_madeAt;

		public Comment() {}

		public Comment(DateTime madeAt, string author, string content)
		{
			m_madeAt = madeAt;
			m_author = author;
			m_content = content;
		}

		[PrimaryKey(PrimaryKeyType.HiLo)]
		public int Id
		{
			get { return id; }
			protected set { id = value; }
		}

		[Property]
		public string Author
		{
			get { return m_author; }
			set { m_author = value; }
		}

		[Property]
		public string Content
		{
			get { return m_content; }
			set { m_content = value; }
		}

		[Property]
		public DateTime MadeAt
		{
			get { return m_madeAt; }
			set { m_madeAt = value; }
		}

		[BelongsTo]
		public Post Post
		{
			get { return m_post; }
			set { m_post = value; }
		}
	}
}